#import "FlutterBubblePlugin.h"

@implementation FlutterBubblePlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
  FlutterMethodChannel* channel = [FlutterMethodChannel
      methodChannelWithName:@"flutter_bubble"
            binaryMessenger:[registrar messenger]];
  FlutterBubblePlugin* instance = [[FlutterBubblePlugin alloc] init];
  [registrar addMethodCallDelegate:instance channel:channel];
}

- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
  if ([@"getPlatformVersion" isEqualToString:call.method]) {
    result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]);
  } else if ([@"showBubble" isEqualToString:call.method]) {
    // iOS限制：无法实现真正的悬浮窗，返回不支持
    result(@(NO));
  } else if ([@"hideBubble" isEqualToString:call.method]) {
    // iOS限制：无法实现真正的悬浮窗，返回不支持
    result(@(NO));
  } else if ([@"checkPermission" isEqualToString:call.method]) {
    // iOS不需要特殊权限，返回YES
    result(@(YES));
  } else if ([@"requestPermission" isEqualToString:call.method]) {
    // iOS不需要特殊权限，返回YES
    result(@(YES));
  } else {
    result(FlutterMethodNotImplemented);
  }
}

@end
